package dome_013;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * <p>Description: []</p>
 * Created on 2020/12/15
 *
 * @author <a href="mailto: 819712047@qq.com">谢振东 </a>
 * @version 1.0
 */
public class T06_ArrayBlockingQueue {
    private static BlockingQueue<String> strings = new ArrayBlockingQueue<String>(10);

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            strings.put("a" + i);
        }

        //strings.put("aaaa"); //满了就会等待，程序阻塞
        //strings.add("aaaa");
        //strings.offer("aaaa");
        strings.offer("aaaa", 1, TimeUnit.SECONDS);

        System.out.println("strings集合：" + strings);
    }
}
